x11/surface: Avoid resizing if computed size didn't change
authorJonas Ådahl <jadahl@gmail.com>
Sat, 5 Dec 2020 10:40:47 +0000 (11:40 +0100)
committerJonas Ådahl <jadahl@gmail.com>
Mon, 7 Dec 2020 19:37:29 +0000 (20:37 +0100)
This fixes an issue where we'd resize to the previous window size during
interactive resize.

gdk/x11/gdksurface-x11.c
gdk/x11/gdksurface-x11.h

index e80e0beff435dd39eb909c0cf7936d166bffd2a6..66803125637713e3e2b7eed66617198a90389a37 100644 (file)
@@ -325,11 +325,15 @@ compute_toplevel_size (GdkSurface *surface,
       gdk_surface_constrain_size (&geometry, mask,
                                   size.width, size.height,
                                   &size.width, &size.height);
-      if ((impl->next_layout.configured_width != size.width ||
+      if ((impl->last_computed_width != size.width ||
+           impl->last_computed_height != size.height) &&
+          (impl->next_layout.configured_width != size.width ||
            impl->next_layout.configured_height != size.height))
         {
           *width = size.width;
           *height = size.height;
+          impl->last_computed_width = size.width;
+          impl->last_computed_height = size.height;
 
           return TRUE;
         }
index 134ebdf617f04d448fd9fd237ad4fa2827555806..0830407dd0c8e3fdb5d05db91f6305c18b3e411f 100644 (file)
@@ -72,6 +72,9 @@ struct _GdkX11Surface
   int unscaled_width;
   int unscaled_height;
 
+  int last_computed_width;
+  int last_computed_height;
+
   GdkToplevelLayout *toplevel_layout;
 
   struct {